@Service
public class CommentService {
    @Autowired
    private CommentRepository commentRepository;

    public List<Comment> getCommentsByPlaylistId(Long playlistId) {
        return commentRepository.findByPlaylistIdOrderByCreatedAtDesc(playlistId);
    }

    public Comment addComment(Long userId, Long playlistId, String content) {
        Comment comment = new Comment();
        comment.setUserId(userId);
        comment.setPlaylistId(playlistId);
        comment.setContent(content);
        comment.setCreatedAt(LocalDateTime.now());

        return commentRepository.save(comment);
    }

    // 其他评论相关方法...
}
